var express = require('express');
var router = express.Router();
let {Configuration, OpenAIApi} = require('openai');
const configuration = new Configuration({
  organization: "org-hps9yZnreSf5l4CU5OtlE1bT",
  apiKey: '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',
});
const openai = new OpenAIApi(configuration);

router.get('/test', async (req, res) => {
  let result = await openai.createCompletion({
    model: "text-davinci-003",
    prompt: "Hello world",
  });
  console.log(result);
  res.json({code:200,data:{}})
});

module.exports = router;
